import { Edge } from 'butterfly-dag'
import $ from 'jquery'

class BaseEdge extends Edge {
  [x: string]: any
  mounted = () => {
    //监听node的隐藏事件
    this.on('nodeHideEvent', (data) => {
      if (this.sourceNode.id == data.node.id || this.targetNode.id == data.node.id) {
        if (data.hide) {
          $(this.dom).hide()
        } else {
          $(this.dom).show()
          this.redraw()
        }
      }
    })
  }

  draw(obj) {
    const path = super.draw(obj)
    $(path).addClass('base-link')
    return path
  }
  drawLabel(_texts) {}
}

export default BaseEdge
